package com.jxtpro.user;

import java.util.List;

import com.jfinal.kit.Ret;
import com.jxtpro.common.model.User;

/**
 * 用户业务服务
 * @author x
 *
 */
public class UserService {

	public static final UserService srv = new UserService();
	final User dao = new User();
	/**
	 * 按照id查看用户
	 * @param id
	 * @return
	 */
	public Ret findById(Integer id) {
		if (id != null){
			User u = dao.findFirst("select * from user where id=?",id);
			return Ret.create("user", u);
		}
		return Ret.create("user", null);
	}
	
	public Ret all(){
		List<User> users = dao.find("select * from user");
		return Ret.create("users", users);
	}
}
